define(["backbone","cookie"],function(Backbone,cookie){

    var Router = Backbone.Router.extend({
        routes:{
            "":"home",
            "home":"home",
            "market":"market",
            "shopping":"shopping",
            "mine":"mine"
        },

        home:function(){
            require(["jquery","homejs","text!./home/home.html","css1!./home/css/home.css"],function($,homejs,html){
                $("#box").html(html);

              homejs.jieXiHome()

            })
        },

        market:function(){
            require(["jquery","marketjs","text!./market/market.html","css1!market/css/market.css"],function($,marketjs,html){
                $("#box").html(html);
                marketjs.jieXiMarket()

            })
        },

        shopping:function(){
            require(["jquery","shoppingjs","text!./shopping/shopping.html","css1!./shopping/css/shopping.css"],function($,shoppingjs,html){
                $("#box").html(html);
                shoppingjs.shop()
            })
        },


        mine:function(){
          var $user = $("#userName").val();
          var $psd = $("#passWord").val();

          var $name;
          var $mima;

            if ($user==$name && $psd==$mima) {
              require(["jquery","successjs","text!./mine/success.html",'css1!./mine/css/success.css'],function($,successjs,html){
                  $("#box").html(html)
              })
            }else{

              require(["jquery","successjs","text!./mine/mine.html",'css1!./mine/css/mine.css'],function($,successjs,html){
                  $("#box").html(html)
              })
            }





        }

    })


    var router = new Router();
    Backbone.history.start();
})
